import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: () => import('@/views/layout/indexView.vue'),
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'home',
          component: () => import('@/views/home/indexView.vue')
        },
        {
          path: '/msg',
          name: 'msg',
          component: () => import('@/views/msg/indexView.vue')
        },
        {
          path: '/cart',
          name: 'cart',
          component: () => import('@/views/cart/indexView.vue')
        },
        {
          path: '/mine',
          name: 'mine',
          component: () => import('@/views/mine/indexView.vue')
        }
      ]
    },
    {
      path: '/add',
      name: 'add',
      component: () => import('@/views/add/indexView.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/indexView.vue')
    }
  ]
})

export default router
